package com.example.erp.controller.system;

import com.example.erp.dto.systemDTO.MenuDTO;
import com.example.erp.pojo.system.Menu;
import com.example.erp.service.system.MenuService;
import com.example.erp.utils.Result;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("/api/v1/admin/system/menu")
public class MenuController {
    @Autowired
    private MenuService menuService;

    @GetMapping("/list")
    private Result list(MenuDTO menuDTO){
        return menuService.list(menuDTO);
    }

    @PostMapping("/add")
    private Result add(@RequestBody Menu menu){
        return menuService.add(menu);
    }

    @PostMapping("/edit")
    private Result edit(@RequestBody Menu menu){
        return menuService.edit(menu);
    }

    @DeleteMapping("/remove")
    private Result remove(@RequestBody Long id){
        return menuService.remove(id);
    }
}
